<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-user-add">

        <div class="form-group">
            <label class="col-sm-3 control-label">昵称：</label>
            <div class="col-sm-8">
                <input id="nickName" name="nickName" class="form-control"
                       placeholder="请输入昵称"
                onblur="checkNickName()">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">真实姓名：</label>
            <div class="col-sm-8">
                <input id="realName" name="realName" class="form-control" placeholder="请输入真实姓名"
                       onblur="checkRealName()">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">手机号：</label>
            <div class="col-sm-8">
                <input id="phone" name="phone" class="form-control" placeholder="请输入手机号"
                       onblur="checkPhone()">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label" id="imgLabel" >用户头像：</label>
            <input id="headImg" name="headImg" type="hidden" />
            <div class="col-sm-8">
                <div class="uploder-container" imgType="user" fileNum="1">
                    <div class="cxuploder" >
                        <div class="queueList">
                            <div class="placeholder">
                                <div class="filePicker"></div>
                                <p>将照片拖到这里</p>
                            </div>
                        </div>
                        <div class="statusBar" style="display:none;">
                            <div class="btns">
                                <!--<div class="jxfilePicker"></div>-->
                            </div>
                            <div class="info"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">用户类型：</label>
            <div class="col-sm-8">
                <select name="userType" class="form-control m-b" th:with="type=${@dict.getType('user_type')}">
                       <option th:each="dict : ${type}" th:if="${dict.dictValue!='机器人'}" th:text="${dict.dictLabel}"
                               th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>

        <!--<div class="form-group">
            <label class="col-sm-3 control-label">机器人类型：</label>
            <div class="col-sm-8">
                <select name="robotType" class="form-control m-b" th:with="type=${@dict.getType('robot_type')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">机器人受罚类型：</label>
            <div class="col-sm-8">
                <select name="leiType" class="form-control m-b" th:with="type=${@dict.getType('lei_type')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>-->
    </form>
</div>
<div th:include="include::footer"></div>
<div th:include="tool/upload/webuploader :: webuploader"></div>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script type="text/javascript">
    var prefix = ctx + "module/user";
    $("#form-user-add").validate({
        rules: {
            xxxx: {
                required: true,
            },
        }
    });

    function checkPhone(){
        var reg=/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
        var phone=document.getElementById("phone").value;
        if(!reg.test(phone)){
            return alert("手机号码格式不正确!");
        }
    }


    function submitHandler() {
        if ($.validate.form()) {
            //图片
            var imgList = getImgList(0);
            $("#headImg").val(imgList);
            $.operate.save(prefix + "/add", $('#form-user-add').serialize());
        }
    }
</script>
</body>
</html>
